﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Text;

using XianShang.Data;
using XianShang.Common;
using XianShang.Entity;
using XianShang.Data.DataProvider;

namespace XianShang.Data.DataProvider
{
   public class Notice
    {
        /// <summary>
        /// 增加一條信息（來源為空時）
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
       public static int AddNoticeInfo(NoticeInfo Ninfo)
       {
           return DatabaseProvider.GetInstance().AddNoticeInfo(Ninfo);
       }



        /// <summary>
        /// 修改一條公告信息
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
       public static int UpNoticeInfo(NoticeInfo Ninfo)
       {
           return DatabaseProvider.GetInstance().UpNoticeInfo(Ninfo);
       }

        /// <summary>
        /// 獲取信息顯示公告列表
        /// </summary>
        /// <returns></returns>
       public static DataTable GetNoticeInfo()
       {
           return Utils.DrToDt(DatabaseProvider.GetInstance().GetNoticeInfo());

       }
        /// <summary>
        /// 獲取信息顯示公告列表
        /// </summary>
        /// <param name="Top">讀取條數</param>
        /// <returns></returns>
       public static DataTable GetNoticeInfo(int top)
       {
           return Utils.LoadDataRows(DatabaseProvider.GetInstance().GetNoticeInfo(), top, 0);
       }
       /// <summary>
        /// 獲取信息顯示公告列表
        /// </summary>
        /// <param name="isShow">顯示狀態（1顯示0不顯示）</param>
        /// <returns></returns>
        public static DataTable GetNoticeInfoByIsShow(int top,int isShow)
        {
            return Utils.LoadDataRows(DatabaseProvider.GetInstance().GetNoticeInfo(isShow), top, 0);
        }
            /// <summary>
        /// 獲取信息顯示公告列表
        /// </summary>
        /// <param name="isShow">顯示狀態（1顯示0不顯示）</param>
        /// <returns></returns>
        public static DataTable GetNoticeInfoByIsShow(int isShow)
        {
            return Utils.DrToDt(DatabaseProvider.GetInstance().GetNoticeInfo(isShow));
        }
        /// <summary>
        /// 獲取一條要修改的公告信息顯示
        /// </summary>
        /// <returns></returns>
       public static DataSet GetNoticeId(string id)
       {
           return DatabaseProvider.GetInstance().GetNoticeId(id);
       }

        /// <summary>
        /// 根據ID刪除公告信息
        /// </summary>
        /// <returns></returns>
       public static int DelNoticeInfo(string id)
       {
           return DatabaseProvider.GetInstance().DelNoticeInfo(id);
       }
    }
}
